let swiper = new Swiper(".swiper", {
  spaceBetween: 30,
  centeredSlides: true,
  autoplay: {
    delay: 2500,
    disableOnInteraction: false,
  },
  pagination: {
    el: ".swiper-pagination",
    clickable: true,
  },
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
  loop: true,
});
$('.banner').addEventListener('mouseover', function () {
  swiper.autoplay.stop()
})
$('.banner').addEventListener('mouseout', function () {
  swiper.autoplay.start()
})
// api分类
// 定义变量保存路径名
let path = '';
$a('#ul li').forEach(function (v, i) {
  v.addEventListener('mouseover', function () {

    v.style.background = 'deepskyblue'
    v.style.cursor = 'pointer'
    let sc = v.children[0].src
    let index1 = sc.lastIndexOf('/')
    let index2 = sc.lastIndexOf('.')
    path = sc.slice(index1 + 1, index2)
    v.children[0].src = `../../assets/imgs/${path}-c.svg`
  })

  v.addEventListener('mouseout', function () {
    v.style.background = ''
    v.children[0].src = `../../assets/imgs/${path}.svg`
  })

})
window.addEventListener('scroll',function(){
  if(window.scrollY>400){
    $('.top').style.display='block'
  }else{
    $('.top').style.display='none'
  }
  
}),

$('.top').addEventListener('mouseover',function(){
  this.style.backgroundPosition='-161px -213px'
}),

$('.top').addEventListener('mouseout',function(){
  this.style.backgroundPosition='-56px -213px'
}),

$('.top').addEventListener('click',function(){
    scrollTo({
      top:0,
      behavior:'smooth'
    })
    
    
})
// 行业巨头
let index=0;
setInterval(function(){
  $a('.industry-box')[index].classList.remove('dpb')
  ++index
  if(index>=$a('.industry-box').length){
    index=0
  }
  $a('.industry-box')[index].classList.add('dpb')

},3000)